package cn.com.ccxe.core.db.util;

import cn.com.ccxe.core.entity.ListPageLink;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;


public final class ListPageLinkTupleBinding extends TupleBinding<ListPageLink> {

	@Override
	public ListPageLink entryToObject(TupleInput input) {
		ListPageLink link = new ListPageLink();
		
		link.setPath(input.readString());
		link.setUpdateTime(input.readDouble());
		link.setFetchTime(input.readInt());
		link.setStatusCode(input.readInt());
		link.setModuleId(input.readInt());
		link.setTitle(input.readString());
		return link;
	}

	@Override
	public void objectToEntry(ListPageLink link, TupleOutput output) {		
		output.writeString(link.getPath());
		output.writeDouble(link.getUpdateTime());
		output.writeInt(link.getFetchTime());
		output.writeInt(link.getStatusCode());
		output.writeInt(link.getModuleId());
		output.writeString(link.getTitle());
	}
}
